package other;

public class MinChanges {
    public static void main(String[] args) {
        int n = 14;
        int k = 13;
        System.out.println(minChanges(n, k));
    }
    public static int minChanges(int n, int k) {
        int ret = 0;
        while (n > 0 || k > 0) {
            if ((n & 1) == 0 && (k & 1) == 1) {
                return -1;
            }
            if ((n & 1) == 1 && (k & 1) == 0) {
                ret++;
            }
            n >>= 1;
            k >>= 1;
        }
        return ret;
    }
}
